My SQL on client machine - java

I m deploying java desktop application on client machine.used mysql database,
how to connect to database without install any environment on client machine ?

You must ship/deliver your client (desktop) application with the JDBC driver (assuming you are NOT using ODBC) for MySQL...that's it!
UPDATE
Of course, make sure it is available in the Java classpath.

Related

Connectng SQL Server 2012 with Java using JDBC

I am using sqljdbc4.jar for connecting SQL Server 2008 with java application using Windows authentication. Everything works perfectly up to date until I tried to run the same code with SQL Server 2012.
After research, I came to know that I need to enable the TCP/IP. But my problem is, my applications will be distributed to users in the form of .EXE and users will install the application themselves. Also, all users will have the SQL SERVER 2012 pre-installed, my application is not supposed to install the sql server.
Now my question is, how can I connect to SQL server without enabling TCP/IP manually? I heard about shared memory protocol also, but not sure how its connection string will look like?
I am using below connection url till SQL Server 2008:
jdbc:sqlserver://localhost;instanceName=SQLServer12;databaseName=Test;integratedSecurity=true;SelectMethod=direct;responseBuffering=adaptive
Please give your suggestions so I can try it here. Thanks in advance.
Try adding the property Network Library=dbmslpcn; OR Net=dbmslpcn; to the connection string for Shared Memory. The default value is dbmssocn (TCP/IP).
Network Library: The network library used to establish a connection to an instance of SQL Server. The corresponding network DLL must be installed on the system to which you connect. If you do not specify a network and you use a local server (for example, "." or "(local)"), shared memory is used.
I got this from: https://www.connectionstrings.com/all-sql-server-connection-string-keywords

Connect to MonetDB via JDBC without specifying database name on Linux

Our Java application works as the following:
- it connects to the server without specifying any database name,
- checks if the given database exists and creates a new one if not.
On Windows, the application works fine but on Linux it cannot connect to the server. The error message: "monetdbd: please specify a database".
We would like to run the same Java application on Linux and Windows. Is there any method to check and create database from Java on both operating system?
We have figured it out at last. A client can connect to an existing database only. On Windows the installer creates a demo database. If other database is not specified, the client connects to it automatically.
On Linux the installer does not create any database, so it should be created
manually.

do i need a tomcat server to make java jdbc swing application to run on lan

I am attempting to create a MySQL and Java client app for my home network.On the server machine I successfully connected to the MySQL as root
Now I want to connect to MySQL from my client PC using the Java client program,
How to do this??
Do i need to install Tomcat Server to run on server for this.
I am using Windows 7 on all my clients and server machines.
Tomcat server is used for web applications.You just need to create a JDBC code and in the URL string just give the ip address of the system where mysql is installed.For example
connection = DriverManager
.getConnection("jdbc:mysql://192.168.1.205:3306/database_name","root", "password");
Also if you have not granted the permission in mysql then grant it .See this for granting permission for access to mysql on remote system
Depending on what you want to achieve, you need to establish a JDBC connection to the server. Take a look at the JDBC trail for more details.
This will allow you to connect directly from you client machine to your database server. This would be done using the required JDBC connection URL for the MySQL connection, for example jdbc:mysql://[host][,failoverhost...][:port]/[database] ยป
[?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]..., check out Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J for more details.
You may also need to configure your MySQL server to allow remote access before you can connect
You just need to do two things:
Make sure the server hosting MySQL allows incoming connections
Write JDBC code and use your MySQL server hostname/ipaddress in the jdbc string to connect and use it.

Connecting to a database on another machine through Java application

If a java desktop application from a client machine needs to connect to a database on an external central server (on another machine), kind of like a php script that can connect from a browser on the client machine to a database, how would that be accomplished? I know that you can use JDBC, but wouldn't the person who's running the desktop application need mysql connector/j driver installed on his/her computer?
As long as you bundle the appropriate JDBC driver (usually a jar) with the application and make sure it's on the runtime classpath everything should work. There is no "installation" of the driver separate from having the appropriate classes on the application's classpath.
Of course: if an application is using JDBC to connect to a DB they'll need the appropriate JDBC driver.
Most applications already have a set of library dependencies; it would just be another one.

Testing MySQL database on LAN client

I am attempting to create a MySQL DB and Java client app for my home network. I haven't really had any experience with MySQL other than PHPMyAdmin for a website backend (also have used SQLite). I have downloaded the full MySQL installation and a test DB from the MySQL website. On the server machine I successfully connected to the DB as root. Not a difficult task.
Now I want to connect to the DB from my client PC, just to check I can. Eventually I will use the JDBC driver to connect from my Java client app, but before that I just want to check I can connect.
How should I do this? SHould I just install the MySQL command line program onto the client PC?
EXTRA INFO: forgot to add, I'm using Windows 7 on all my machines.
Yes, you could install the MySQL to get MySQL command line program and connect with it, but also you can use another MySQL client tool like PHPMyAdmin, dbForge Studio for MySQL or another one.
To connect from remote host you should create special accout for it, e.g. - 'user_name'#'your_host_name'. Find more information here -
Specifying Account Names
Account Names and Passwords

Categories

Resources