I am developing a database application in Java. I want to use SOUNDEX() function of SQL, but when I try to do this, I get an error reporting "undefined function SOUNDEX() in expression". Is it really undefined?
My query is as follows:
SELECT * from students WHERE SOUNDEX(studentName) = SOUNDEX('ali');
This is not an issue with JDBC, but with the database server you are using. As far as I see, only MSSQL supports the SOUNDEX function. So if you are using MySQL, Derby or an other database server, you are unable to use it. Which one do you use?
To verify that this is a database problem and not a JDBC problem, you can manually connect to the SQL server and then try to perform the query.
Related
I have used the exact same Driver Name, Connection URL , User Name and Password for connecting to my Oracle 11g Express edition database running on my local(same) machine from 2 codes.
Simple Java code to connect to DB and read values from a table.
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:#localhost:1521:xe",
"SYSTEM","Platz#123"
);
In Hibernate persistence.xml
The Simple java connection works as expected, However Hibernate gives me the error "java.sql.SQLException: ORA-01017: invalid username/password; logon denied".
Does this has to do anything with the oracle installation configurations on my machine? Or if it is something else.
Could you please provide and explanation and the way out.
I believe the standard JPA property name for the user name is:
javax.persistence.jdbc.user
Not:
javax.persistence.jdbc.username
Crate database offers a jdbc driver through which I should be able to connect to Crate from Nifi using DBCPConnectionPool controller service. So I did that, I get a connection, the ConvertJSONToSQL processor is able to get the columns from the Crate database but when I get to the PUTSql processor I get the following error:
FlowFileHandlingException: transfer relationship not specified
The thing is that I have a SUCCESS, FAILURE, RETRY relationship defined. It just throws a ProcessException in the onTrigger() method.
Any ideas how can I make it work ?
As soon as the jdbc driver is compatible it should work, but ...
I believe this is a bug in PutSQL that is hiding an issue either in the JDBC configuration, SQL statement, or something else. Using the standalone JDBC driver with valid SQL INSERT statements, I was able to PutSQL working with Crate.
Can you double-check your connection information and SQL statement(s)? Also if you can reproduce and want to share the SQL and/or connection info (JDBC URL, e.g.), please feel free, it could help get to the bottom of the PutSQL bug that is hiding another issue.
this is the error I get when I'm trying to connect to my local postgresql db:
Cannot connect to database [default]
this is the database configuration. I'm convinced that there is not typo (fat finger error):
db.default.url="postgres://localhost:5432/myproject/"
db.default.user="postgres"
db.default.pass="mypassword"
db.default.driver="org.postgresql.Driver"
db.default.initSQL="SELECT 1"
where is the problem? with pgAdmin I can connect easily
p.s.
I'm using ubuntu. I've noticed that in order to change to postgres user
I must use "su", otherwise it fails changing the current user.
is that has something to do with play! failure to connect my db?
thanks
There might be two things wrong or at least dubious in your setup.
First: The postgres:... URL syntax is not a plain JDBC URL. This format is not understood by the PostgreSQL JDBC driver. See this answer to a similar problem.
Second: You are trying to use the PostgreSQL superuser account for Play. The superuser account should be used only for administrative work, but not "normal" work. Especially not for work which includes public access to the DB via some webfrontend. Any SQL-Injection attack gives the attacker the golden key to your database - including the nuke to wreck your complete DB cluster at once or install any backdoor into you DB server.
So I recommand, that you create a new user which you configure in your Play! settings.
That said: The default password for the postgres user is not set on Ubuntu. This setup allows login to the DB user only from the same OS user. How you can fix this is explained in this answer.
If these two tips don't help: The error you quoted is very vague. There must be more detailed error logs somewhere. Please find them and attach them to your question with the "edit" button.
This is not an answer directly to your question, but I had the same error message and came here via Google. Using Scala Play 2.3, I had
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://127.0.0.1:5432/noob_development"
db.default.logStatements=true
which needed to be
db.default.driver="org.postgresql.Driver"
db.default.url="jdbc:postgresql://127.0.0.1:5432/noob_development"
db.default.logStatements=true
I accidentally left the quotes around the driver name out. Now it works perfectly.
here is my conf, it works:
db.default.url="jdbc:postgresql://127.0.0.1:5432/dbname"
db.default.driver="org.postgresql.Driver"
just add the jdbc: before postgresql in db.default.url.
I created the jdbc connection successfully for hsqldb in stanlone mode.I found where the new database is created.Using the path of newly created database in runserver ,I created some tables.But when I tried to get those table using jdbc connection,I could not get those table.
connection url is:"jdbc:hsqldb:file:databasename;ifexist=true","SA",""
for getting tables I m using the following query.
"select table_name from information_schema.system_tables where table_type='table'";
I am using hsqldb 2.2.7.
You seem to be trying to access the database simultaneously via Server and in-process. This is not possible. After each type of access, you need to shutdown the database before you connect to it via the alternative type of access. Therefore shutdown the Server once you have created the tables, then connect to the database in-process.
It is easier to access the database via Server only, and avoid such problems. Please also upgrade to version 2.2.8 to avoid a bug which may affect a database that has not been shutdown properly.
I'm currently working on a java program that will access an Microsoft SQL Server using the JDBC-ODBC bridge driver provided in the Java distribution.
Everything seems to be setup correctly and I can query basic data from the database, but when I try to run a query that gets a UniqueIdentifer field in it, when I do the subsequent ResultSet.getString() it fails with:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Numeric value out of range
Has anyone experienced anything like this before? This works using the JDBC driver provided by Microsoft, but the customer wants to use the DSN they created.
If this is helpful when I run a Connection.getMetaData(); the UniqueIdentifer field returns a DATA_TYPE of 1111
If you call a batch of two or more Microsoft SQL Server stored procedures by using the ODBC Driver for SQL Server and by using the ODBC canonical {call X} method, you may receive the following error message from the driver:
Numeric Value Out Of Range
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.